//
//  CollageTextField.m
//  xiaoyuanshenghuoquan
//
//  Created by Fenrir on 13-11-13.
//  Copyright (c) 2013年 mypocketbaby.com. All rights reserved.
//

#import "CollageTextField.h"

@implementation CollageTextField

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        
        self.placeholder = @"请选择所在的学校";
        self.font = _SYS_FONT_003;
        self.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        [self setBackground:[UIImage imageNamed:@"com_bg_010"]];
        self.leftViewMode = UITextFieldViewModeAlways;
        self.rightViewMode = UITextFieldViewModeAlways;
        
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 70.0f, 30.0f)];
        label.font = _SYS_FONT_004;
        label.backgroundColor = [UIColor clearColor];
        label.text = @"所在学校";
        self.leftView = label;
        
        UIImageView *arrowView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 10.0f, 16.0f)];
        arrowView.image = [UIImage imageNamed:@"com_icon_008"];
        self.rightView = arrowView;
        
    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
}
*/

- (CGRect)leftViewRectForBounds:(CGRect)bounds
{
    return CGRectMake(5.0f, 5.0f, self.leftView.frame.size.width, self.leftView.frame.size.height);
}

- (CGRect)rightViewRectForBounds:(CGRect)bounds
{
    return CGRectMake(bounds.size.width-5.0f-self.rightView.frame.size.width, 13.0f, self.rightView.frame.size.width, self.rightView.frame.size.height);
}
@end
